package com.example.mysdktest.base;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v7.app.AppCompatActivity;

/**
 * Base activity of myself activity baseActivity
 * {@link android.app.Activity}
 * <p>
 * Created by baichuan on 2016/11/15.
 */
public abstract class BaseActivity extends AppCompatActivity {

    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        super.setContentView(getLaout());

        initView();
        initData();
        initListener();
    }

    /**
     * name:getlayout()
     * method:
     *
     * @return Id resouse
     */
    public abstract int getLaout();

    /**
     * name:initView()
     * function:init this activty views
     */
    public abstract void initView();

    /**
     * name:initData()
     * function:init Data after initView before listerner
     */
    public abstract void initData();

    /**
     * <p color=blue>name:initListener</P>
     * function:initListener
     */
    public abstract void initListener();


    /**
     * name:jump2other
     * jump to target activity
     *
     * @param targetActivity target activity class
     */
    public void jump2other(Class<Activity> targetActivity) {
        startActivity(new Intent(this, targetActivity));
    }

}
